package practicedemo55;

import java.util.ArrayList;

public class PhoneTest {
    public static void main(String[] args) {
        ArrayList<Phone> list = new ArrayList<>();
        list.add(new Phone("小米", 1000));
        list.add(new Phone("苹果", 8000));
        list.add(new Phone("锤子", 2999));
        System.out.println(method(list).toString());
    }

    public static ArrayList<Phone> method(ArrayList<Phone> list) {
        ArrayList<Phone> newList = new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getPrice() < 3000) {
                newList.add(list.get(i));
            }
        }
        return newList;
    }
}
